﻿using JNPF.Basics.Models;
using JNPF.Utils;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace JNPF.Basics.Logic
{
    /// <summary>
    /// 系统消息
    /// 版 本：V3.0.0
    /// 版 权：引迈信息技术有限公司（https://www.jnpfsoft.com）
    /// 作 者：JNPF开发平台组
    /// 日 期：2017-12-27 
    /// </summary>
    internal interface MessageIService
    {
        /// <summary>
        /// 列表（通知公告）
        /// </summary>
        /// <param name="requestParam">请求参数</param>
        /// <returns></returns>
        Task<PageResult<MessageEntity>> GetNoticeList(PageInput requestParam);
        /// <summary>
        /// 列表（通知公告/系统消息/私信消息）
        /// </summary>
        /// <param name="requestParam">请求参数</param>
        /// <param name="userId">当前用户</param>
        /// <param name="type">类别</param>
        /// <returns></returns>
        Task<PageResult<MessageEntity>> GetMessageList(PageInput requestParam, string userId, string type = null);
        /// <summary>
        /// 信息
        /// </summary>
        /// <param name="id">主键值</param>
        /// <returns></returns>
        Task<MessageEntity> GetInfo(string id);
        /// <summary>
        /// 默认消息
        /// </summary>
        /// <param name="type">类别:1-通知公告/2-系统消息</param>
        /// <returns></returns>
        Task<MessageEntity> GetInfoDefault(int type);
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        Task Delete(MessageEntity entity);
        /// <summary>
        /// 创建
        /// </summary>
        /// <param name="entity">实体对象</param>
        Task Create(MessageEntity entity);
        /// <summary>
        /// 创建
        /// </summary>
        /// <param name="entity">实体对象</param>
        /// <param name="receiveEntityList">收件用户</param>
        Task Create(MessageEntity entity, List<MessageReceiveEntity> receiveEntityList);
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="entity">实体对象</param>
        Task Update(MessageEntity entity);
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="entity">实体对象</param>
        /// <param name="receiveEntityList">收件用户</param>
        Task Update(MessageEntity entity, List<MessageReceiveEntity> receiveEntityList);
        /// <summary>
        /// 消息已读（单条）
        /// </summary>
        /// <param name="userId">当前用户</param>
        /// <param name="messageId">消息主键</param>
        Task MessageRead(string userId, string messageId);
        /// <summary>
        /// 消息已读（全部）
        /// </summary>
        /// <param name="userId">当前用户</param>
        Task MessageRead(string userId);
        /// <summary>
        /// 删除记录
        /// </summary>
        /// <param name="userId">当前用户</param>
        /// <param name="messageIds">消息Id</param>
        Task DeleteRecord(string userId, List<string> messageIds);
        /// <summary>
        /// 获取未读数量（含 通知公告、系统消息）
        /// </summary>
        /// <param name="userId">用户主键</param>
        /// <returns></returns>
        Task<int> GetUnreadCount(string userId);
        /// <summary>
        /// 获取公告未读数量
        /// </summary>
        /// <param name="userId">用户主键</param>
        /// <returns></returns>
        Task<int> GetUnreadNoticeCount(string userId);
        /// <summary>
        /// 获取消息未读数量
        /// </summary>
        /// <param name="userId">用户主键</param>
        /// <returns></returns>
        Task<int> GetUnreadMessageCount(string userId);
    }
}
